package mysql

import (
	"gitee.com/xuxinzhi2206/corehub/database/mysql"
	"gorm.io/gorm"
)

type Goods struct {
	gorm.Model
	GoodsId    int64  `gorm:"type:int(11);comment:商品id"`
	GoodsName  string `gorm:"type:varchar(50);comment:商品名称"`
	GoodsPrice string `gorm:"type:varchar(50);comment:商品价格"`
	GoodsNum   int64  `gorm:"type:int(11);comment:商品数量"`
}

func (g *Goods) CreateGoods() error {
	return mysql.WithMysql(func(db *gorm.DB) error {
		return db.Create(g).Error
	})
}
